package cn.mw.cmdb.entity;

import cn.mw.cmdb.param.QueryMonitorParam;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.google.common.base.Strings;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * item数据
 */
@Data
public class ItemDropInfo extends QueryMonitorParam {
    @Schema(description = "监控项id")
    public String itemid;

    @Schema(description = "监控项id")
    public List<String> itemids;

    @Schema(description = "监控项名称")
    public String name;

    @Schema(description = "监控项设备名称")
    public String devName;

    @Schema(description = "监控项中文名称")
    public String chName;

    @Schema(description = "监控项单位")
    private String units;

    @Schema(description = "时间间隔")
    private String delay;

    private String lastValue;

    private String lastUpdateTime;

    @Schema(description = "0：数字浮点；1：字符；2：日志；3：数字无符号；4：文字")
    private Integer value_type;

    private String valuemapid;

    @Schema(description = "自动发现规则id")
    private String discoverId;

    public void itemIdsConvert(){
        if(CollectionUtils.isEmpty(itemids) && !Strings.isNullOrEmpty(itemid)){
            itemids = new ArrayList<>();
            itemids.add(itemid);
        }
    }
}
